﻿@model IEnumerable<Microsoft.AspNetCore.Identity.IdentityRole>

<br />
<div class="card shadow border-0 mt-4">
    <div class="card-header bg-success bg-gradient ml-0 py-3">
        <div class="row">
            <div class="col-12 text-center">
                <h2 class="text-white py-2">Role List</h2>
            </div>
        </div>
    </div>


    <div class="card-body p-4">

        <div class="row pb-3">
            <div class="col-6"></div>
            <div class="col-3 offset-3 text-end">
                <a asp-action="Upsert" class="btn btn-primary form-control">Create Role</a>
            </div>
        </div>

        @if (Model.Count() > 0)
        {
            <table class="table table-bordered table-striped">
                <tr class="table-secondary">
                    <th>ID</th>
                    <th>Name</th>
                    <th></th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>@item.Id</td>
                        <td>@item.Name</td>
                        <td>
                            <div class="text-center">
                                <form asp-action="Delete" asp-route-roleId="@item.Id">
                                    <a asp-action="Upsert" asp-route-roleId="@item.Id" class="btn btn-info text-white" style="course:pointer">
                                        Edit
                                    </a>

                                    <button type="submit" onclick="return confirm('Are you sure you want to delete this?')" class="btn btn-danger">
                                        DELETE
                                    </button>
                                </form>
                            </div>
                        </td>
                    </tr>
                }
            </table>
        }
    </div>


</div>
